package mnfstedit

import "kumachan/interpreter/compiler/loader/manifest"

type module struct {
	data    manifest.Module
	deps    *dependencyList
	notify  func()
}
func newModule(notify func()) (*module, *dependencyList) {
	var mod = &module {
		data:   manifest.Module {},
		notify: notify,
	}
	var deps = newDependencyList(&(mod.data.Dependencies), notify)
	mod.deps = deps
	return mod, deps
}
func (mod *module) Get() manifest.Module {
	return mod.data
}
func (mod *module) Init(data manifest.Module, k func(manifest.Module)) {
	mod.data = data
	mod.deps.resetCurrent()
	k(mod.data)
}
func (mod *module) Mutate(f func(data *manifest.Module)) {
	f(&(mod.data))
	mod.notify()
}


